/**
*文件用途说明：com_ui_XcountdownTimer 倒计时
*作者：徐国南
*制作日期： 2013-5-10
**/
/*
function MillisecondToDate(msd){
	//var dat = new Date("2011/11/11 20:10:10");
	//var mili = (dat).getTime();
	//var newTime = new Date(mili); 

    var time = parseFloat(msd) / 1000;
    //console.log(time);
    
    if (time != null && time != "" ) {
        if (time > 60 && time < 60 * 60) {
            time = parseInt(time / 60.0) + "分钟" + parseInt((parseFloat(time / 60.0) -
                parseInt(time / 60.0)) * 60) + "秒";
        }else if (time >= 60 * 60 && time < 60 * 60 * 24) {
            time = parseInt(time / 3600.0) + "小时" + parseInt((parseFloat(time / 3600.0) -
                parseInt(time / 3600.0)) * 60) + "分钟" +
                parseInt((parseFloat((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60) -
                parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) * 60) + "秒";
        }else {
            time = parseInt(time) + "秒";
        }
    }
    return time;
}
*/
//var a = MillisecondToDate(1321013410000);
//console.log(a);

//var mili = new Date('Sat May 11 2013 16:12:04 GMT+0800');
//console.log(newTime);


	var maxtime = 60*60*60*48;
	//一个小时，按秒计算，自己调整!
	function countDown(){
		//var maxtime=maxtime,
		var	hours,
			minutes,
			seconds,
			outputMsg;
			
		if(maxtime>=0){
			hours = Math.floor(maxtime/60/60/60),  
			minutes = Math.floor(maxtime/60/60/60/48), 
			seconds = Math.floor(maxtime%60),
			outputMsg = "距离结束还有 ：  " + hours + "小时" + minutes + "分" + seconds + "秒";
			
			//outputMsg = "距离结束还有 ：  " + maxtime;		
			timerbox.innerHTML = outputMsg;
	
			if(maxtime == 5*60) {
				alert('注意，您的还有5分钟来创建，请选择，延时!');
			}
			
			--maxtime;
		}else{
			clearInterval(timer);
			alert("时间到，结束!");
		}
	};

$(function(){
	var timerbox = document.getElementById("timerbox"),
		timer = setInterval(countDown, 1000);
});

